<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>

<%
	request.setAttribute("title","保险公司信息");
	request.setAttribute("modelConfigPath", "insu");
%>

<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<style type="text/css">
.content{
	margin-buttom:28px;
}
</style>

<t:panel cssClass="panel-flat form-detailed" customBody="true" customHead="true">
    <div class="detailed-navbar-content panel-body">
        <t:form commandName="insuranceCompany" action="/admin/insu/insuranceCompany/save" method="post" cssClass="form-horizontal">
            <div class="hide">
                <t:hidden path="id"/>
                <t:hidden path="deleteMark"/>
                <t:input path="icon" type="hidden" />
            </div>
            <t:formgroup>
                <t:label path="shortName" cssClass="col-sm-2" />
                <t:input path="shortName" colClass="col-sm-4" />
                <t:label path="hotLine" cssClass="col-sm-2" />
                <t:input path="hotLine" colClass="col-sm-4" /> 
            </t:formgroup>
            <t:formgroup>
              <div class="col-sm-6">
                 <t:label path="icon" cssClass="col-sm-4" />
                    <div class="col-sm-4">
                    <c:if test="${insuranceCompany.icon!=null && insuranceCompany.icon!=''}">
					    <img style="width:100px; height:80px;" id="mainPicShow" src="${tfn:getFileUrl(insuranceCompany.icon)}" /> 
				    </c:if>
				    <c:if test="${insuranceCompany.icon ==null || insuranceCompany.icon==''}">
						 <img style="width:100px; height:80px;" id="mainPicShow" src="<c:url value='/images/we/invitationIndex/bg1.jpg' />" />
				    </c:if>
				    </div>
				    <div class="col-sm-4">
				    <label>加载进度</label>
                      <div style="width:100px;height: 10px;margin-top:0.5rem; border: 2px solid #afafaf;border-radius:15px;"class="mainParent">
        			    <div style="width:0px;height: 7px;background-color: #afafaf" class="mainProgress"></div>
        		      </div>
					<button type="button" class="btn-info" id="deleteMainPic" style="padding-left:10px; margin-top:1rem; border-radius:6px;">删除图片</button> 
        		    </div>
                </div>
            </t:formgroup>
            <t:formgroup>
                <t:label path="comments" cssClass="col-sm-2" />
                <t:ueditor path="comments" style="height:150px" colClass="col-sm-10" />
            </t:formgroup>
        </t:form>
    </div>
    <div class="navbar-fixed-bottom">
	<t:panelFoot headingBtnCssClass="heading-btn pull-right-important">
		<t:button icon="icon-floppy-disk" onclick="saveData()" cssClass="btn-info" csize="sm">保存</t:button>
	</t:panelFoot>
	</div>
</t:panel>

<script type="text/javascript">
	function saveData(){
		if (!$("form:first").valid()){
			return;
		}
		$("form:first").submit(); 

	}	

	/* -------------------------进度条--------------------------- */
	$(function(){
		$("#mainPicShow").on('click',function(e) {
			$(".mainProgress").width(0);
			$("#icon").startCosFileUpload({
				fillImg:"#mainPicShow",
				progressCallback:function(curr, sha1){
					$(".mainParent").show();
					$(".mainProgress").width(0);
					$(".mainProgress").width(sha1*96);
				}
			});
		});

	});	
	
	/* -------------------------删除图片--------------------------- */
	$(function(){
		$("#deleteMainPic").on('click',function(e){
			$(".mainProgress").width(0);
			$("#mainPicShow").attr("src",$.getVirtualPath()+"/images/we/invitationIndex/bg1.jpg");
			$("#mainImg").val("");
		});

	});

</script>
<%@ include file="/WEB-INF/views/shared/base/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formpickers.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared/scripts/editor/ueditor.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/tools/upload-cos.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentFooter.jsp"%>
